<%@ include file="/WEB-INF/include/base.jsp" %>
<%@ include file="/WEB-INF/include/user.jsp" %>
<%@ include file="/WEB-INF/include/initialize_logged.jsp" %>
<%@ include file="/WEB-INF/include/userSession.jsp" %>
<%@ page import="com.web.bdo.util.UserDataUtil" %>
<%@ page isELIgnored="false" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="./common/css/master.css"/>
<% UserDataUtil.setDetails(request);	%>
</head>
<body>	
	<table id="page">
		<com:header>
			This is a header
		</com:header>
		<com:subheader>
			<com:sub_h_item label="Home" action="${path }/Home.do"/>
			<com:sub_h_item label="Account" action="${path }/AccountPage.do?select=1"/>
			<com:sub_h_item label="Log out" action="${path }/Logout.do"/>
		</com:subheader>		
		<com:main_nav>
			<com:nav_item label="Home" action="${path }/Welcome.do" active="true"/>				
			<com:nav_item label="Flights" action="${path }/Flights.do"/>
			<com:nav_item label="About Us" action="${path }/About Us.do"/>
			<com:nav_item label="Contact Us" action="${path }/Contact Us.do"/>
		</com:main_nav>
		<com:content>
			<table>				
				<tr>
					<td id="sidebar">
						<a href="${path }/AccountPage.do?select=0">Back to User Details</a>
					</td>
					<td id="content_i" style="width:700px;">
						<html:form action="/EditUser.do">
							<signup:form heading="Edit User">
								<signup:error_h>									
									<html:messages id="errors" message="true" property="heading">
										<com:error_m>
											<c:out value="${errors }"/>
										</com:error_m>
									</html:messages>
									<html:messages id="errors" message="true" property="cancelEdit">
										<com:error_m>
											<c:out value="${errors }"/>
										</com:error_m>									
									</html:messages>									
								</signup:error_h>									
								<signup:note>
									<li>All fields required.</li>
								</signup:note>
								<signup:field label="E-mail address">
									<html:hidden property="id" value="${user.id }"/>
									<html:text property="emailAddress" value="${user.emailAddress }"/>
								</signup:field>
								<signup:error>
									<html:messages id="errors" message="true" property="emailAddress">
										<c:out value="${errors }"/>
									</html:messages>
								</signup:error>
								<signup:field label="Password | Confirm password">
									<html:password property="password" value="${user.password }"/>
									<html:password property="password1"/>
								</signup:field>
								<signup:error>
									<html:messages id="errors" message="true" property="password">
										<c:out value="${errors }"/>
									</html:messages>
									<html:messages id="errors" message="true" property="password1">
										<c:out value="${errors }"/>
									</html:messages>
								</signup:error>								
								<signup:field label="First | Last Name">
									<html:text property="firstName" value="${user.firstName }"/>
									<html:text property="lastName" value="${user.lastName }"/>
								</signup:field>
								<signup:error>
									<html:messages id="errors" message="true" property="firstName">
										<c:out value="${errors }"/>
									</html:messages>
									<html:messages id="errors" message="true" property="lastName">
										<c:out value="${errors }"/>
									</html:messages>
								</signup:error>								
								<signup:field label="Country">
									<jsp:useBean id="countries" scope="page" class="com.web.util.obj.CountryList"/>
									<html:select property="country" value="${user.country }">
									<html:option value="">Select country</html:option>
										<c:forEach var="country" items="${countries }">
											<html:option value="${country.value }">
												<c:out value="${country.label }"></c:out>
											</html:option>
										</c:forEach>
									</html:select>									
								</signup:field>
								<signup:error>
									<html:messages id="errors" message="true" property="country">
										<c:out value="${errors }"/>
									</html:messages>
								</signup:error>
								<signup:field label="Sex">
									<html:select property="sex" value="${user.sex + 1 }">
										<html:option value="0">Select</html:option>
										<html:option value="1">Male</html:option>
										<html:option value="2">Female</html:option>
									</html:select>									
								</signup:field>
								<signup:error>
									<html:messages id="errors" message="true" property="sex">
										<c:out value="${errors }"/>
									</html:messages>
								</signup:error>
								<signup:field label="Age">
									<html:select property="age" value="${user.age }">
										<html:option value="0">Select</html:option>
										<c:forEach var="i" begin="12" end="60">
											<html:option value="${i }"><c:out value="${i }"/></html:option>
										</c:forEach>
									</html:select>
								</signup:field>
								<signup:error>
									<html:messages id="errors" message="true" property="age">
										<c:out value="${errors }"/>
									</html:messages>
								</signup:error>								
								<signup:command>
									<html:cancel value="Cancel"/>
									<html:reset value="Reset"/>
									<html:submit value="Submit"/>									
							</signup:command>
							</signup:form>
						</html:form>
					</td>
					<td>&nbsp;</td>
				</tr>
			</table>
		</com:content>
		<com:footer>
			This is a footer
		</com:footer>
	</table>
</body>
</html>